import axios from "@/http/axios";

const articleCatAll=()=>{
    return axios.request({
        url:'/api/articleCat/all',
        method:'get',
    })
}
const getArticlesAll=()=>{
    return axios.request({
        url:'/api/article/all',
        method:'get',
    })
}
const getArticlesByPage=(data)=>{
    return axios.request({
        url:'/api/article/page',
        method:'post',
        data
    })
}
const getArticlesByUserId=(userId)=>{
    return axios.request({
        url:`/api/article/getArticles/${userId}`,
        method:'get',
    })
}
const getArticlesOne=(id)=>{
    return axios.request({
        url:'/api/article/one',
        method:'get',
        params:{
            'id':id,
        }
    })
}
const getArticlesByCateId=(cateId)=>{
    return axios.request({
        url:`/api/article/${cateId}`,
        method:'get',
    })
}
const deleteArticleById=(id)=>{
    return axios.request({
        url:`/api/article/delete/${id}`,
        method:'get',
    })
}

export {articleCatAll,getArticlesAll,getArticlesByUserId,getArticlesByCateId,getArticlesOne,deleteArticleById,getArticlesByPage}